/**
 * 
 */
package project.reguli;

import jess.Context;
import jess.JessException;
import jess.RU;
import jess.Userfunction;
import jess.Value;
import jess.ValueVector;

/**
 * @author Aarni
 *
 */
public class ConstrangereLaptop implements Userfunction {

	/* (non-Javadoc)
	 * @see jess.Userfunction#call(jess.ValueVector, jess.Context)
	 */
	@Override
	public Value call(ValueVector arg0, Context arg1) throws JessException {
		
		int ora = arg0.get(2).intValue(arg1);
		String nume = arg0.get(1).stringValue(arg1);

		if (nume.equals("Laptop") && ora < 6 && ora > 22) {
			return new Value(3, RU.INTEGER);
		}

		return new Value(0, RU.INTEGER);
	}

	/* (non-Javadoc)
	 * @see jess.Userfunction#getName()
	 */
	@Override
	public String getName() {
		return "ConstrangereLaptop";
	}

}
